// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.radio.globals;

public final class RadioGlobalString extends RadioGlobal<String> {
    public RadioGlobalString(String value) {
        super(value, RadioGlobalType.String);
    }

    public RadioGlobalString(String name, String value) {
        super(name, value, RadioGlobalType.String);
    }

    public String getValue() {
        return this.value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String getString() {
        return this.value;
    }

    @Override
    public CompareResult compare(RadioGlobal target, CompareMethod method) {
        if (target instanceof RadioGlobalString radioGlobalString) {
            switch (method) {
                case equals:
                    return this.value.equals(radioGlobalString.getValue()) ? CompareResult.True : CompareResult.False;
                case notequals:
                    return !this.value.equals(radioGlobalString.getValue()) ? CompareResult.True : CompareResult.False;
                default:
                    return CompareResult.Invalid;
            }
        } else {
            return CompareResult.Invalid;
        }
    }

    @Override
    public boolean setValue(RadioGlobal value, EditGlobalOps operator) {
        if (operator.equals(EditGlobalOps.set) && value instanceof RadioGlobalString) {
            this.value = ((RadioGlobalString)value).getValue();
            return true;
        } else {
            return false;
        }
    }
}
